//
//  OperatableStatuCell.m
//  MonitoringNetwork
//
//  Created by admin on 2017/12/22.
//  Copyright © 2017年 wtmcxlm. All rights reserved.
//

#import "OperatableStatuCell.h"


@interface OperatableStatuCell()
//运营
//@property (nonatomic,strong)UILabel *operatTruckLabel;
//@property (nonatomic,strong)UILabel *operatChargeCarLabel;
//@property (nonatomic,strong)UILabel *operatOtherLabel;
//
////闲置
//@property (nonatomic,strong)UILabel *idleTruckLabel;
//@property (nonatomic,strong)UILabel *idleChargeCarLabel;
//@property (nonatomic,strong)UILabel *idleOtherLabel;
//
////allstate
//@property (nonatomic,strong)UILabel *allTruckLabel;
//@property (nonatomic,strong)UILabel *allChargeCarLabel;
//@property (nonatomic,strong)UILabel *allOtherLabel;


//All types
@property (nonatomic,strong)UILabel *operatAllLabel;
@property (nonatomic,strong)UILabel *idleAllLabel;
@property (nonatomic,strong)UILabel *allALLLabel;

//@property (nonatomic,strong)UIView *lineOne;
//@property (nonatomic,strong)UIView *lineTwo;


@end

@implementation OperatableStatuCell

//- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
//{
//    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
//    if (self) {
//        self.backgroundColor = [UIColor whiteColor];
//        [self setUpUI];
//    }
//    return self;
//}
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    UIView *backView = [UIView new];
    backView.backgroundColor = [UIColor colorWithRed:0.97f green:0.97f blue:0.97f alpha:1.00f];
    [self addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(self);
        make.height.mas_equalTo(11);
    }];
    UILabel *label6 = [UILabel LabelWithFont:TitleLagerFontSize andColor:TitleColor andTextAlignment:left andString:@"车辆类型运营状态统计"];
    [self addSubview:label6];
    [label6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(33);
        make.bottom.mas_equalTo(self.mas_top).offset(110/3+11);
    }];
    
    UILabel *label7 = [UILabel LabelWithFont:NormalFontSize andColor:[UIColor colorWithRed:0.28f green:0.70f blue:0.08f alpha:1.00f] andTextAlignment:center andString:@"运营"];
    [self addSubview:label7];
    [label7 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.25);
        make.width.mas_equalTo(kScreenWidth*0.20);
        make.bottom.mas_equalTo(self.mas_top).offset(75+11);
    }];
    
    UILabel *label8 = [UILabel LabelWithFont:NormalFontSize andColor:[UIColor colorWithRed:0.15f green:0.53f blue:0.91f alpha:1.00f] andTextAlignment:center andString:@"闲置"];
    [self addSubview:label8];
    [label8 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.45);
        make.width.mas_equalTo(kScreenWidth*0.20);
        make.bottom.mas_equalTo(label7);
    }];
    
    UILabel *label9 = [UILabel LabelWithFont:NormalFontSize andColor:[UIColor colorWithRed:0.92f green:0.41f blue:0.64f alpha:1.00f] andTextAlignment:left andString:@"全部状态"];
    [self addSubview:label9];
    [label9 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.75);
        make.width.mas_equalTo(kScreenWidth*0.20);
        make.bottom.mas_equalTo(label7);
    }];
    
//    @property (nonatomic,strong)UILabel *operatAllLabel;
//    @property (nonatomic,strong)UILabel *idleAllLabel;
//    @property (nonatomic,strong)UILabel *allALLLabel;
    
    _operatAllLabel = [UILabel LabelWithFont:NormalFontSize andColor:[UIColor colorWithRed:0.28f green:0.70f blue:0.08f alpha:1.00f] andTextAlignment:center andString:@"0"];
    [self addSubview:_operatAllLabel];
    [_operatAllLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(label7);
        make.width.mas_equalTo(kScreenWidth*0.20f);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-34);
    }];
    _idleAllLabel = [UILabel LabelWithFont:NormalFontSize andColor:[UIColor colorWithRed:0.15f green:0.53f blue:0.91f alpha:1.00f] andTextAlignment:center andString:@"0"];
    [self addSubview:_idleAllLabel];
    [_idleAllLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(label8);
        make.width.mas_equalTo(kScreenWidth*0.20f);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-34);
    }];
    _allALLLabel = [UILabel LabelWithFont:NormalFontSize andColor:[UIColor colorWithRed:0.92f green:0.41f blue:0.64f alpha:1.00f] andTextAlignment:left andString:@"0"];
    [self addSubview:_allALLLabel];
    [_allALLLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(label9);
        make.width.mas_equalTo(kScreenWidth*0.20f);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-34);
    }];
    
    UIView *lineOne = [UIView new];
    [self addSubview:lineOne];
    lineOne.backgroundColor = [UIColor colorWithRed:0.85f green:0.85f blue:0.85f alpha:1.00f];
    [lineOne mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(29);
        make.right.mas_equalTo(self.mas_right).offset(-29);
        make.height.mas_equalTo(1);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-200/3.0f);
    }];
    
    UIView *lineTwo = [UIView new];
    [self addSubview:lineTwo];
    lineTwo.backgroundColor = [UIColor colorWithRed:0.85f green:0.85f blue:0.85f alpha:1.00f];
    [lineTwo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.73);
        make.width.mas_equalTo(1);
        make.top.mas_equalTo(self.mas_top).offset(59);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-76/3.0f);
    }];
    
    UILabel *label10 = [UILabel LabelWithFont:NormalFontSize andColor:TitleColor andTextAlignment:left andString:@"全部类型"];
    [self addSubview:label10];
    [label10 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self).offset(29);
        make.bottom.mas_equalTo(self.mas_bottom).offset(-34);
    }];
    
}
- (void)laodUIWithDataArr:(NSArray *)arr
{
    int useNum = 0;
    int notuseNum = 0;
    int totalNum = 0;
    for (int i=0; i<arr.count; i++) {
        NSDictionary *dict = arr[i];
        useNum += [dict[@"useNum"] intValue];
        notuseNum += [dict[@"notUse"] intValue];
        totalNum += [dict[@"totalNum"] intValue];
        UILabel *nameLabel = [UILabel LabelWithFont:NormalFontSize andColor:TitleColor andTextAlignment:left andString:dict[@"name"]];
        [self addSubview:nameLabel];
        [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(29);
            make.bottom.mas_equalTo(self.mas_top).offset(337/3.0f+120/3.0f*i);
        }];
        
        UILabel *useLabel = [UILabel LabelWithFont:NormalFontSize andColor:NumColor andTextAlignment:center andString:[NSString separatedDigitStringWithStr:[NSString stringWithFormat:@"%@",dict[@"useNum"]]]];
        [self addSubview:useLabel];
        [useLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.25);
            make.width.mas_equalTo(kScreenWidth*0.20);
            make.bottom.mas_equalTo(nameLabel);
        }];
        UILabel *notuseLabel = [UILabel LabelWithFont:NormalFontSize andColor:TitleColor andTextAlignment:center andString:[NSString separatedDigitStringWithStr:[NSString stringWithFormat:@"%@",dict[@"notUse"]]]];
        [self addSubview:notuseLabel];
        [notuseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.45);
            make.width.mas_equalTo(kScreenWidth*0.20);
            make.bottom.mas_equalTo(nameLabel);
        }];
        UILabel *totalLabel = [UILabel LabelWithFont:NormalFontSize andColor:TitleColor andTextAlignment:left andString:[NSString separatedDigitStringWithStr:[NSString stringWithFormat:@"%@",dict[@"totalNum"]]]];
        [self addSubview:totalLabel];
        [totalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(kScreenWidth*0.75);
            make.width.mas_equalTo(kScreenWidth*0.20);
            make.bottom.mas_equalTo(nameLabel);
        }];
    }
    _operatAllLabel.text = [NSString separatedDigitStringWithStr:[NSString stringWithFormat:@"%d",useNum]];
    _idleAllLabel.text = [NSString separatedDigitStringWithStr:[NSString stringWithFormat:@"%d",notuseNum]];
    _allALLLabel.text = [NSString separatedDigitStringWithStr:[NSString stringWithFormat:@"%d",totalNum]];
}






@end
